<?php
// +----------------------------------------------------------------------
// | 门户展示帮助模块
// +----------------------------------------------------------------------
// | Author: 张坤
// +----------------------------------------------------------------------
namespace Admin\Controller; 
class FaqsController extends AdminController { 
	/**
	 * 图片展示 
	 */
	public function index() {
		$picInfo=M('Faqs')->select();
		$this->assign("_list",$picInfo);
		$this->display('index');
	} 
	/**
	 * 保存图片
	 */
	public function save() { 
		$res = D('Faqs')->update();
		if(!$res){
			$this->error(D('Faqs')->getError());
		}else{
			$this->success('保存成功！', U('Faqs/index'));
		}
	}
	/**
	 * 删除图片
	 */
	public function delete($id) { 
		$map ['id'] = $id;
		M("Faqs")->where($map)->delete();		
		$this->redirect('index');
	}
	/**
	 * 修改前显示
	 */
	public function edit($id) {
		//当前编辑页面 
		$data = M ( 'Faqs' )->field ( true )->find ( $id );
		$this->assign ( 'data', $data );
		//所有信息
		$picInfos=M('Faqs')->select();
		$this->assign("_list",$picInfos);
		$this->display('index');
	}
	
}
